package org.nepu.scr.indexrate.converter.drillingrate.keydevice.wellcontrolsystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.wellcontrolsystem.Bop;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class BopConverter implements AttributeConverter<Bop, String> {
    @Override
    public String convertToDatabaseColumn(Bop bop) {
        return JSONUtil.toJsonStr(bop);
    }

    @Override
    public Bop convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, Bop.class);
    }
}
